package com.ute.chinesechess;

public class Ma extends QuanCo {
	public boolean KiemTra(int i, int j) {
		if (i >= 0 && i <= 9 && j >= 0 && j <= 8) {
			if ((i != Hang - 2 || j != Cot - 1)
					&& (i != Hang - 2 || j != Cot + 1)
					&& (i != Hang - 1 || j != Cot + 2)
					&& (i != Hang + 1 || j != Cot + 2)
					&& (i != Hang + 2 || j != Cot - 1)
					&& (i != Hang + 2 || j != Cot + 1)
					&& (i != Hang - 1 || j != Cot - 2)
					&& (i != Hang + 1 || j != Cot - 2)) {
				return false;
			}
			if ((i == Hang - 2 && j == Cot - 1)
					|| (i == Hang - 2 && j == Cot + 1)) {
				if (BanCo.board[Hang - 1][Cot].Trong == false)
					return false;
			}
			if ((i == Hang - 1 && j == Cot + 2)
					|| (i == Hang + 1 && j == Cot + 2)) {
				if (BanCo.board[Hang][Cot + 1].Trong == false)
					return false;
			}
			if ((i == Hang + 2 && j == Cot - 1)
					|| (i == Hang + 2 && j == Cot + 1)) {
				if (BanCo.board[Hang + 1][Cot].Trong == false)
					return false;
			}
			if ((i == Hang - 1 && j == Cot - 2)
					|| (i == Hang + 1 && j == Cot - 2)) {
				if (BanCo.board[Hang][Cot - 1].Trong == false)
					return false;
			}
			if (BanCo.board[i][j].Trong == false) {
				if (BanCo.board[i][j].Phe == this.Phe)
					return false;
			}
		}
		return true;
	}
}
